package net.malkuth.test.fragment;

import android.annotation.TargetApi;
import android.app.Fragment;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import net.malkuth.adapter.QueryAdapter;
import net.malkuth.data.QueryData;
import net.malkuth.test.R;

/**
 * Created by 一些年华 on 2016/7/7.
 * 查询
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class QueryFragment extends Fragment {

    private QueryAdapter queryAdapter;
    private ListView list_query;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_query, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();

    }

    private void initView() {
        list_query = (ListView) getActivity().findViewById(R.id.list_query);
        queryAdapter = new QueryAdapter(QueryData.getdata(), getActivity());
        list_query.setAdapter(queryAdapter);
    }

    @Override
    public void onResume() {
        /*if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }*/
        super.onResume();
    }
}
